import request from '@/utils/request'

// 创建投票用户信息
export function createUserInfo(data) {
  return request({
    url: '/vote/user-info/create',
    method: 'post',
    data: data
  })
}

// 更新投票用户信息
export function updateUserInfo(data) {
  return request({
    url: '/vote/user-info/update',
    method: 'put',
    data: data
  })
}

// 删除投票用户信息
export function deleteUserInfo(id) {
  return request({
    url: '/vote/user-info/delete?id=' + id,
    method: 'delete'
  })
}

// 获得投票用户信息
export function getUserInfo(id) {
  return request({
    url: '/vote/user-info/get?id=' + id,
    method: 'get'
  })
}

// 获得投票用户信息分页
export function getUserInfoPage(query) {
  return request({
    url: '/vote/user-info/page',
    method: 'get',
    params: query
  })
}

// 导出投票用户信息 Excel
export function exportUserInfoExcel(query) {
  return request({
    url: '/vote/user-info/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}


// 更改用户状态
export function changeUserStatue(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/vote/user-info/change-user-statue',
    method: 'post',
    data: data,
  })
}

// 下载用户导入模板
export function importTemplate() {
  return request({
    url: '/vote/user-info/get-import-template',
    method: 'get',
    responseType: 'blob'
  })
}
